package cn.bld.service;

import cn.bld.entity.SysUser;
import cn.bld.mapper.SysUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysUserServiceImpl implements SysUserService {
    @Autowired
    private SysUserMapper sysUserMapper;
    @Override
    public SysUser login(String account, String password) {
        return sysUserMapper.login(account,password);
    }

    @Override
    public List<SysUser> show() {
        return sysUserMapper.show();
    }

    @Override
    public Integer findCount(String realName, Integer roleId) {
        return sysUserMapper.findCount(realName,roleId);
    }

    @Override
    public List<SysUser> findByCondition(String realName, Integer roleId, Integer pageNo, Integer size) {
        int offset=(pageNo-1)*size;
        return sysUserMapper.findByCondition(realName,roleId,offset,size);
    }

    @Override
    public int delById(Integer id) {
        return sysUserMapper.delById(id);
    }

    @Override
    public int checkAccount(String account) {
        return sysUserMapper.checkAccount(account);
    }

    @Override
    public int insertUser(SysUser sysUser) {
        return sysUserMapper.insertUser(sysUser);
    }

    @Override
    public SysUser findGyId(Integer id) {
        return sysUserMapper.findGyId(id);
    }

    @Override
    public int updateUser(SysUser sysUser) {
        return sysUserMapper.updateUser(sysUser);
    }

    @Override
    public int deleteUser(Integer userid) {
        return sysUserMapper.deleteUser(userid);
    }

    @Override
    public int checkPassowrd(String oldPassword, Integer id) {
        return sysUserMapper.checkPassowrd(oldPassword,id);
    }

    @Override
    public int updatePassword(Integer id,String newpassword) {
        return sysUserMapper.updatePassword(id,newpassword);
    }
}
